package com.wms.common;

import com.wms.dao.SystemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;

@Component
public class StartupRunner implements ApplicationRunner {

    @Autowired
    private SystemMapper systemMapper;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        List<Map> list = systemMapper.getTableKeyConfigShow();
        for (Map map : list){
            Config.table_key.put((String) map.get("tvalue"), String.valueOf(map.get("sumTag")) );
        }
        //设置每个表格number长度
        Config.tableNumberLength.put("goods",3L);
        Config.tableNumberLength.put("in_store_idx",4L);
        Config.tableNumberLength.put("out_store_idx",4L);
    }
}
